import { ApiEnum } from '@/enums/api-enums';
import { get, post } from '@/request/index';

export const AuthService = {
  /**
   * 用户登录
   * @param data 登录请求参数
   * @returns 返回Token数据
   */
  login: (data: AuthApiReq.AuthInfo): Promise<ApiResponse<AuthApiResp.Token>> => {
    return post<AuthApiResp.Token>(ApiEnum.USER_LOGIN, data);
  },

  /**
   * 获取验证码
   * @returns 返回验证码
   */
  fetchCaptcha: (): Promise<ApiResponse<AuthApiResp.Captcha>> => {
    return get<AuthApiResp.Captcha>(ApiEnum.CAPTCHA_CODE);
  },
};
